package cc.vicp.djx314.starfood.service.account;

import org.springframework.core.io.Resource;
import org.springframework.dao.DataAccessException;

import cc.vicp.djx314.starfood.domain.account.User;
import cc.vicp.djx314.starfood.service.exception.UserNotFoundException;

public interface UserInfoService {
	/**
	 * 获取用户头像
	 * @param id
	 * @return
	 * @throws UserNotFoundException
	 */
	public Resource getUserHeadImg(Integer id) throws UserNotFoundException;
	/**
	 * 判断用户昵称是否存在
	 * @param nickName
	 * @return
	 */
	public boolean isNickNameExists(String nickName);
	/**
	 * 用户注册
	 * @param user
	 * @param headImg
	 * @return
	 * @throws Exception 
	 */
	public void createUser(User user, byte[] headImg) throws Exception;
	/**
	 * 根据账号名获取user信息
	 * @param accountName
	 * @return
	 * @throws DataAccessException 
	 * @throws UserNotFoundException 
	 */
	public User getUserInfo(String accountName) throws UserNotFoundException, DataAccessException;

	public User getAllUserInfo(Integer userId) throws UserNotFoundException;

	public void updateUserInfo(User user) throws Exception;
	/**
	 * 判断除了user本人以外的nickName是否存在
	 * @param user
	 * @return
	 */
	public boolean getIfOtherUserNickNameExists(User user);

	public void updateUserPhoto(Integer userId, byte[] imageFile) throws Exception;
}
